<?php

/**
 * detFactura filter form base class.
 *
 * @package    aeropostal
 * @subpackage filter
 * @author     Your name here
 */
abstract class BasedetFacturaFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'cargoFactura' => new sfWidgetFormPropelChoice(array('model' => 'Cargofactura', 'add_empty' => true)),
      'cantidad'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'precioU'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'impuesto'     => new sfWidgetFormPropelChoice(array('model' => 'Impuesto', 'add_empty' => true)),
      'factura'      => new sfWidgetFormPropelChoice(array('model' => 'Factura', 'add_empty' => true)),
      'aeronave'     => new sfWidgetFormPropelChoice(array('model' => 'Aeronave', 'add_empty' => true)),
      'vuelo'        => new sfWidgetFormPropelChoice(array('model' => 'Vuelo', 'add_empty' => true)),
      'estacion'     => new sfWidgetFormPropelChoice(array('model' => 'Estacion', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'cargoFactura' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Cargofactura', 'column' => 'id')),
      'cantidad'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'precioU'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'impuesto'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Impuesto', 'column' => 'id')),
      'factura'      => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Factura', 'column' => 'numero')),
      'aeronave'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Aeronave', 'column' => 'serial')),
      'vuelo'        => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Vuelo', 'column' => 'numVuelo')),
      'estacion'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Estacion', 'column' => 'codigo')),
    ));

    $this->widgetSchema->setNameFormat('det_factura_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'detFactura';
  }

  public function getFields()
  {
    return array(
      'id'           => 'Number',
      'cargoFactura' => 'ForeignKey',
      'cantidad'     => 'Number',
      'precioU'      => 'Number',
      'impuesto'     => 'ForeignKey',
      'factura'      => 'ForeignKey',
      'aeronave'     => 'ForeignKey',
      'vuelo'        => 'ForeignKey',
      'estacion'     => 'ForeignKey',
    );
  }
}
